package hr.fer.tel.adhoc.c2d;

import adhoc.tel.fer.hr.R;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.util.Log;

public class MessageReceivedActivity extends Activity {
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		Bundle extras = getIntent().getExtras();
		if (extras != null) {
			String message = extras.getString("payload");

			AlertDialog alertDialog = new AlertDialog.Builder(this).create();
			alertDialog.setMessage(message);
			alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
				public void onClick(DialogInterface dialog, int which) {
					dialog.dismiss();
					MessageReceivedActivity.this.finish();
				}
			});
			alertDialog.setIcon(R.drawable.icon);
			alertDialog.show();
		}

		Log.i("" + this, "showed");
	}

}